-
Notifications
You must be signed in to change notification settings - Fork 151
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add option to list plugins #2319
base: main
Are you sure you want to change the base?
Conversation
dff3d5c
to
3a3ba2b
Compare
Backend Code coverage changed from 59.3% to 59.3%. Change: 0% 😃. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks.
I wrote a few notes about how the backend/ code is organized.
btw, Probably this option could be documented somewhere? We don't have a page for all options. The headlamp-plugin tool has them listed in its README.md. If you don't have any inspiration for this at the moment, we can document the command line arguments in a separate PR.
5d19c8a
to
2c966db
Compare
Backend Code coverage changed from 60.1% to 60.0%. Change: -.1% 😞. |
2c966db
to
fe72ef2
Compare
Backend Code coverage changed from 60.1% to 60.0%. Change: -.1% 😞. |
fe72ef2
to
e1efd3d
Compare
Backend Code coverage changed from 60.1% to 60.0%. Change: -.1% 😞. |
Looks good to me. But I think we can wait for Joaquim to see if it meets his requirements before merging. ps. To make the code coverage bot use a happy face emoji you might consider adding a test for ListPlugins(possibly using a mock for GenerateSeparatePluginPaths). |
05b326d
to
8e99e17
Compare
was looking into this from our sync earlier this week so far so good |
Backend Code coverage changed from 60.1% to 60.4%. Change: .3% 😃. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Tested and it works. Thanks!
Left a couple of comments to improve things.
app/electron/main.ts
Outdated
// If the user wants to list plugins, we don't need to start the app. | ||
if (listPlugins) { | ||
const staticDir = path.join(process.resourcesPath, '.plugins'); | ||
const pluginsDir = path.join(app.getPath('userData'), 'plugins'); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is there a way to get this one from the plugin manager? We should always try to have one source of truth for data.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Tried testing using PluginManager's list
function, but it would break and return empty lists. I tried testing changes to checkValidPluginFolder
to see if that would fix it but it caused new JS issues. I've made the other change and can continue testing with PluginManager but I seem to be hitting a wall with this
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think we are using 3 sources of truth in this PR:
- The backend
- The PluginManager
- This app module
If we want to keep the backend and plugin manager independent, I think we need ot keep those two separated. But this main module needs to be using the source from one of the others. Since the backend has a new list-plugins command, we could as well just call that from command from here and not replicate the logic we got there.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Changed this to call execSync using the backend logic
8e99e17
to
cd07a56
Compare
Backend Code coverage changed from 60.1% to 60.4%. Change: .3% 😃. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Some suggestions.
0834cd7
to
11cde63
Compare
Backend Code coverage changed from 60.1% to 60.3%. Change: .2% 😃. |
@@ -25,6 +25,7 @@ type Config struct { | |||
InsecureSsl bool `koanf:"insecure-ssl"` | |||
EnableHelm bool `koanf:"enable-helm"` | |||
EnableDynamicClusters bool `koanf:"enable-dynamic-clusters"` | |||
ListPlugins bool `koanf:"list-plugins"` |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@yolossn This is not really a config option. It's rather a subcommand.
So I wonder if we shouldn't include it in the koanf config. Do you know if there's an option to modify that in koanf, or should we use the flag parsing in a different way?
app/electron/main.ts
Outdated
// If the user wants to list plugins, we don't need to start the app. | ||
if (listPlugins) { | ||
const staticDir = path.join(process.resourcesPath, '.plugins'); | ||
const pluginsDir = path.join(app.getPath('userData'), 'plugins'); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think we are using 3 sources of truth in this PR:
- The backend
- The PluginManager
- This app module
If we want to keep the backend and plugin manager independent, I think we need ot keep those two separated. But this main module needs to be using the source from one of the others. Since the backend has a new list-plugins command, we could as well just call that from command from here and not replicate the logic we got there.
11cde63
to
01cb826
Compare
This change creates a CLI option in the backend + desktop to list all plugins, with a distinction between static/shipped plugins and user-added ones. Fixes: #2161 Signed-off-by: Evangelos Skopelitis <eskopelitis@microsoft.com>
01cb826
to
a11ec3a
Compare
Backend Code coverage changed from 60.1% to 60.4%. Change: .3% 😃. Coverage report
|
This change creates a CLI option in the backend + desktop to list all plugins, with a distinction between static/shipped plugins and user-added ones.
Fixes: #2161
Testing
Backend
make backend
cd backend && ./headlamp-server --list-plugins
and ensure that the list of plugins shows upDesktop
cd app && npm run build
cd dist/linux-unpacked && ./headlamp --list-plugins
and ensure that the list of plugins shows up